package com.classroom.smart.service;

import com.classroom.smart.mapper.AlbumMapper;
import com.classroom.smart.pojo.Album;
import com.classroom.smart.pojo.AlbumExample;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther:YouGuoyun
 * @Title:leetcode
 * @Date:Create in 2023/2/25 10:23
 **/
@Service
public class AlbumService {

    @Autowired
    private AlbumMapper albumMapper;

    public List<Album> viewAllAlbum(int current,String query){
        AlbumExample albumExample = new AlbumExample();
        AlbumExample.Criteria criteria = albumExample.createCriteria();
        criteria.andNameLike("%" + query + "%");
        PageHelper.startPage(current,3);
        List<Album> list = albumMapper.selectByExample(albumExample);
        return list;
    }

}
